The Python interpreter has a number of functions built into it that
are always available. They are listed here in alphabetical order.
openfilename mode bufsize
Return a new file object (described earlier under Built-in Types).
The first two arguments are the same as for stdio's
fopen(): filename is the file name to be opened,
mode indicates how the file is to be opened: 'r' for
reading, 'w' for writing (truncating an existing file), and
'a' opens it for appending. Modes 'r+', 'w+' and
'a+' open the file for updating, provided the underlying
stdio library understands this. On systems that differentiate
between binary and text files, 'b' appended to the mode opens
the file in binary mode. If the file cannot be opened, IOError
is raised.
If mode is omitted, it defaults to 'r'.
The optional bufsize argument specifies the file's desired
buffer size: 0 means unbuffered, 1 means line buffered, any other
positive value means use a buffer of (approximately) that size. A
negative bufsize means to use the system default, which is
usually line buffered for for tty devices and fully buffered for other
files.